package com.campus.help.common;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 学校类型枚举
 *
 * @author campus-help
 * @since 2025-09-18
 */
@Getter
@AllArgsConstructor
public enum SchoolType {

    /**
     * 大学
     */
    UNIVERSITY("university", "大学"),

    /**
     * 学院
     */
    COLLEGE("college", "学院"),

    /**
     * 职业院校
     */
    VOCATIONAL("vocational", "职业院校");

    /**
     * 类型码
     */
    private final String code;

    /**
     * 类型描述
     */
    private final String description;

    /**
     * 根据类型码获取枚举
     */
    public static SchoolType fromCode(String code) {
        for (SchoolType type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown school type code: " + code);
    }
}
